CC := gcc
CFLAGS := -Wall -Werror -std=c11
TARGET := cmdLine
SRCS := $(shell find ./src -name "*.c")
INC_DIRS := $(shell find . -name "inc" -type d)
LIB_DIRS := $(shell find . -name "lib" -type d)
LIBS := -lpthread
OBJS := $(SRCS:.c=.o)

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)

%.o: %.c
	$(CC) $(CFLAGS) $(addprefix -I,$(INC_DIRS)) -c $< -o $@

clean:
	rm -f $(OBJS) $(TARGET)
